#include "TypeVariableEntry.h"
#include "Factory_xNodeType.h"
#include "NodeOutPort.h"
#include "WOP_Entry.h"

using namespace std;

TypeVariableEntry::TypeVariableEntry(void)
{
}

TypeVariableEntry::~TypeVariableEntry(void)
{
	clearEntryList();
	clearWopList();
}

//manager 透過此新增一個entry在其上
void TypeVariableEntry::addEntryToList( WOP_Entry* entry, xMappingTree* xmt ,bool entryCanUnfold )
{
	xNodeType* nodeType = Factory_xNodeType::create_xnodetype("wop",entry);
	xMappingNode* wopNode = xmt->create_node(nodeType);
	xmt->add_input_terminal(wopNode);
	
	this->_entryList.push_back(wopNode);
	this->_wopList.push_back(entry);
	
}

vector<xMappingNode*>& TypeVariableEntry::getEntryList()
{
	return this->_entryList;
}

vector<WOP_Entry*>& TypeVariableEntry::getWopList()
{
	return this->_wopList;
}


string TypeVariableEntry::getEntryNameAT( int index )
{
	return _wopList.at(index)->getName();
}

string TypeVariableEntry::getEntryTypeAT( int index )
{
	return _wopList.at(index)->getTypeStr();
}

void TypeVariableEntry::clearEntryList()
{
	_entryList.clear();
}

void TypeVariableEntry::clearWopList()
{
	_wopList.clear();
}
